<?php
$f = $this->form ;
$cruiseCabin = $this->cruiseCabin;
?>
<div class="mainpage">
<form method="post" class="form-horizontal" enctype="multipart/form-data">
	<div class="top-tools">
        <?php echo $this->flashMessenger()?>
        <a href="/admin/cruise-itinerary-tour" class="exit  btn " ><i class="icon-hand-left hint" data-hint-msg="Quay lại"></i></a>

        <div class="pull-right">
            <?php echo $f->getDefaultActionGroup() ?>
        </div>
        <div class="clear"></div>
    </div>

    <div class="row-fluid">
    	<h3 class="form-legend"><?php echo $f->getLegend() ?></h3>
    </div>

    <div class="row-fluid">
        <div class="span12">
            <!-- form add -->
            <?php
            echo $f->getElement('cruise_id');
            echo $f->getElement('cruise_itinerary_id');
            echo $f->getElement('special_offer');
            echo $f->getElement('best_selling');
            echo $f->getElement('en_title');
            echo $f->getElement('title');
            echo $f->getElement('thumbnail');
            ?>
            <div class="control-group">
                <label for="price" class="control-label required">Price </label>
                <div class="controls price">
                <!-- price table -->
                <table class="table tbl" border="1" style="width:60%;">
                    <thead>
                        <tr>
                            <th rowspan="2"><?php echo $this->translate('Cabin_type') ?></th>
                            <th colspan="5">Price/Per Pax(USD)</th>
                            <th rowspan="2">SGL Supp</th>
                        </tr>
                        <tr>
                            <?php if($cruiseCabin): ?>
                                <?php foreach($cruiseCabin[0]['price'] as $k => $v): ?>
                                    <th><input name="number_customer_<?php echo $k + 1 ?>" value="<?php echo $v['number_customer'] ?>"></th>
                                <?php endforeach; ?>
                            <?php else: ?>
                                <th><input name="number_customer_1" value="2-3"></th>
                                <th><input name="number_customer_2" value="4-7"></th>
                                <th><input name="number_customer_3" value="8-11"></th>
                                <th><input name="number_customer_4" value="11-14"></th>
                                <th><input name="number_customer_5" value="15+1"></th>
                            <?php endif; ?>
                        </tr>
                    </thead>
                    <tbody>
                        <?php if($cruiseCabin): ?>
                            <?php foreach($cruiseCabin as $key => $value): ?>
                            <tr>
                                <td  style="text-align:left"><input type="text" name="cabin_type[]" value="<?php echo $value['cabin_type'] ?>" style="width:auto;text-align:left"></td>
                                <?php foreach($value['price'] as $k => $v): ?>
                                    <td><input name="price_<?php echo ($k+1) ?>[]" value="<?php echo $v['price'] ?>"></td>
                                <?php endforeach; ?>
                                <td><input name="sgl[]" value="<?php echo $value['sgl_supp'] ?>"></td>
                            </tr>
                            <?php endforeach; ?>
                        <?php else: ?>
                        <?php for($i = 0; $i < 6; $i++): ?>
                            <tr>
                                <td><input type="text" name="cabin_type[]" style="width:auto;text-align:left"></td>
                                <td><input name="price_1[]"></td>
                                <td><input name="price_2[]"></td>
                                <td><input name="price_3[]"></td>
                                <td><input name="price_4[]"></td>
                                <td><input name="price_5[]"></td>
                                <td><input name="sgl[]"></td>
                            </tr>
                        <?php endfor; ?>
                        <?php endif; ?>
                        <tr class="more_price" style="display:none">
                            <td><input type="text" name="cabin_type[]" style="width:auto;text-align:left"></td>
                            <td><input name="price_1[]"></td>
                            <td><input name="price_2[]"></td>
                            <td><input name="price_3[]"></td>
                            <td><input name="price_4[]"></td>
                            <td><input name="price_5[]"></td>
                            <td><input name="sgl[]"></td>
                        </tr>
                        <tr>
                            <td colspan="8"><input type="button" class="btn btn-primary" style="width:auto;margin:10px" name="add_more_price" id="add_more_price" value="More hotel"></td>
                        </tr>
                    </tbody>
                </table>
                <!-- end price table -->
                </div>
            </div>
            <?php
            echo $f->getElement('en_overview');
            echo $f->getElement('overview');
            echo $f->getElement('en_detail');
            echo $f->getElement('detail');
            echo $f->getElement('meta_keyword');
            echo $f->getElement('meta_description');
            echo $f->getElement('header_title');
            ?>
            <div class="form-action-group">
                <input type="submit" name="submit" id="submit" value="Save" class="btn btn-primary">
                <input type="reset" name="reset" id="reset" value="Reset" class="btn">
            </div>
            <!-- end form add -->
        </div>
    </div>

    <div class="clear"></div>
</form>
</div>

<style>
.price input {
	width: 60px;
	text-align: center;
	border: none;
	webkit-border-radius: none;
    -moz-border-radius: none;
    border-radius: none;
}
.price select{
	width: 70px;
}

.price .table th, .table td {
	padding: 0px;
}

.price .table tr{
	min-height: 20px;
}
.price .table thead th {
    vertical-align: middle;
}
</style>

<script>
$(document).ready(function() {
    $('#add_more_price').click(function() {
    	(t = $('.more_price')).clone().removeClass('more_price').show().insertBefore(t);
        }
    );
});
</script>